﻿using UnityEngine;
using System.Collections;
using PureMVC.Patterns;
using PureMVC.Interfaces;

public class BaseFacade<T> : Facade where T : Facade, new() {

	private static T instance = null;

	static BaseFacade() {
		Debug.Log("static ctor " + typeof(T).Name);
		instance = new T();
	}

	public BaseFacade() : base(typeof(T).Name) {
		Debug.Log("self ctor " + typeof(T).Name);
	}

	public static T getInstance() {
		return instance;
	}
}

public class AppFacade : BaseFacade<AppFacade> {

}

public class MyFacade : BaseFacade<MyFacade> {
	
}

public class ViewFacade : BaseFacade<ViewFacade> {

}

//public class AppFacade : Facade
//{
//	private static AppFacade instance = null;

//	static AppFacade ()
//	{
//		Debug.Log ("static ctor");
//		instance = new AppFacade ();
//	}

//	private AppFacade () : base (typeof(AppFacade).Name){

//		Debug.Log ("self ctor");
//	}

//	public static AppFacade getInstance ()
//	{
//		return instance ;//as AppFacade;
//	}
//}
